package com.bkhech.spring.controller;

import com.bkhech.spring.domain.LevelViews;
import com.bkhech.spring.domain.Student;
import com.fasterxml.jackson.annotation.JsonView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {

    /**
     * GET without any json view
     *
     * @return created Student
     */
    @GetMapping("/levelTwo/default")
    public Student getLevelTwoDefault() {
        return Student.createStudent();
    }

    /**
     * GET with lowest view Public
     *
     * @return created Student
     */
    @JsonView(LevelViews.Public.class)
    @GetMapping("/levelTwo/public")
    public Student getLevelTwoPublic() {
        return Student.createStudent();
    }

    /**
     * GET with SubPublic View which extends Public
     *
     * @return created Student
     */
    @JsonView(LevelViews.SubPublic.class)
    @GetMapping("/levelTwo/basic")
    public Student getLevelTwoBasicDetails() {
        return Student.createStudent();
    }

    /**
     * GET with GrandPublic View which extends SubPublic,Public
     *
     * @return created Student
     */
    @JsonView(LevelViews.GrandPublic.class)
    @GetMapping("/levelTwo/all")
    public Student getLevelTwoAllDetails() {
        return Student.createStudent();
    }

}